package com.xiaour.spring.boot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: liushijiang
 * @Desc:
 * @create: 2025-06-17 14:14
 **/
@RestController
@RequestMapping("/user")
@RefreshScope
public class UserController {
    @Autowired
    private DiscoveryClient discoveryClient;

//    @Value("${demo}")
    private String dateformat="123";

    @GetMapping("/now")
    public String getDateFormat(){
        //获取当前微服务的名字

        return dateformat;
    }
    @GetMapping("/services")
    public List<String> getServices() {
        return discoveryClient.getServices();
    }
}
